package com.company.jdk8;

import jdk.nashorn.internal.ir.CallNode;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.Month;
import java.time.temporal.ChronoField;

/**
 *
 * @ProjectName: 复习java
 * @Package: com.company.jdk8
 * @ClassName: Jdk8Date
 * @Author: wym
 * @Date: 2020/9/15 10:56
 * @Version: 1.0
 */
public class Jdk8Date {
    public static void main(String[] args) {
        //localDate 获取 年月日

        //获取当前年月日
        LocalDate localDate = LocalDate.now();
        //构造指定的年月日
        LocalDate localDate1 = LocalDate.of(2019, 9, 10);

        int year = localDate.getYear();
        int year1 = localDate.get(ChronoField.YEAR);
        Month month = localDate.getMonth();
        int month1 = localDate.get(ChronoField.MONTH_OF_YEAR);
        int day = localDate.getDayOfMonth();
        int day1 = localDate.get(ChronoField.DAY_OF_MONTH);
        DayOfWeek dayOfWeek = localDate.getDayOfWeek();
        int dayOfWeek1 = localDate.get(ChronoField.DAY_OF_WEEK);
        System.out.println("---------------------");
        //localTime 获取 几点几分几秒
        LocalTime of = LocalTime.of(13, 51, 10);
        LocalTime localTime = LocalTime.now();
        int hour = localTime.getHour();

        int minute = localTime.getMinute();

        int second = localTime.getSecond();

        System.out.println(of);
        //localDateTiem 获取年月日时分秒 localDate +localTiem

    }

}

